<template>
	<view class="service-item" @click="onClick">
		<image class="slot-image" :src="item.serverIcom" mode="widthFix"></image>
		<view class="service-right">
			<view class="service-header">
				<image class="user-image" :src="item.userIcon" mode="widthFix"></image>
				<view class="service-info">
					<view class="service-info-top">
						<label class="service-user" v-html="item.userName"></label>
						<text class="service-info-line"></text>
						<label class="service-job" v-html="item.userJob"></label>
					</view>
					<label class="service-company" v-html="item.company"></label>
				</view>
			</view>
			<view class="service-rate">
				<uni-rate class="user-score-rate" :readonly="true" :size="10" :value="item.score" />
				<label class="user-score">{{item.score}}</label>
				<label class="user-score-text">分</label>
			</view>
			<view class="service-tips">
				<image class="service-tips-icon" src="../static/images/icon_service-tips@3x.png"></image>
				<label class="service-tips-item" v-for="(tips,index) in item.tipsList" :key="index">{{tips}}</label>
			</view>
			<view class="service-content" v-html="item.content">
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				item: this.options
			}
		},
		props: {
			options: {
				type: Object,
				default: {}
			},
			searchValue: {
				type: String,
				default: ""
			}
		},
		mounted() {
			if (this.searchValue) {
				this.item.userName = this.item.userName.replace(this.searchValue, '<label style="color:red">' + this
					.searchValue + '</label>')
				this.item.userJob = this.item.userJob.replace(this.searchValue, '<label style="color:red">' + this
					.searchValue + '</label>')
				this.item.company = this.item.company.replace(this.searchValue, '<label style="color:red">' + this
					.searchValue + '</label>')
				this.$forceUpdate()
			}
		},
		methods: {
			onClick: function() {
				this.$emit("click", this.options.id)
			}
		}
	}
</script>

<style>
	.service-item {
		padding: 28rpx 24rpx;
		display: flex;
		box-shadow: 0px 0px 8rpx rgba(138, 133, 133, 0.35);
		border-radius: 8rpx;
		margin: 24rpx 5rpx;
	}

	.slot-image {
		width: 248rpx;
		height: 248rpx;
		border-radius: 4rpx;
		margin-right: 16rpx;
		background-color: #007AFF;
	}

	.service-right {
		flex: 1;
		display: flex;
		flex-flow: column;
	}

	.service-header {
		display: flex;
		align-items: center;
	}

	.user-image {
		width: 72rpx;
		height: 72rpx;
		border-radius: 50%;
		margin-right: 20rpx;
		background-color: #007AFF;
	}

	.service-info {
		flex: 1;
		display: flex;
		flex-flow: column;
	}

	.service-info-top {
		display: flex;
		justify-content: space-between;
		align-items: center;
		color: #181818;
		font-size: 32rpx;
	}

	.service-info-line {
		width: 1px;
		height: 18rpx;
		background-color: #ACACAC;
		display: block;
	}

	.service-company {
		margin-top: 14rpx;
		font-size: 24rpx;
		color: #7B7B7B;
		width: 264rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.service-rate {
		margin-top: 14rpx;
		display: flex;
		align-items: center;
	}

	.user-score {
		color: #FFCC09;
		font-size: 24rpx;
		margin-left: 12rpx;
	}

	.user-score-text {
		font-size: 20rpx;
		color: #5A5A5A;
		margin-left: 10rpx;
	}

	.service-content {
		margin-top: 18rpx;
		color: #7B7B7B;
		font-size: 24rpx;
		width: 374rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}
</style>
